package com.devilvan.betrice.aiqicha.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author Evad.Wu
 * @Description 爱企查-招/投标信息 映射
 * @date 2022-09-24
 */
@Setter
@Getter
@ToString(exclude = "aiqichaHeaderPo")
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "AIQICHA_TENDER_BIDDING")

@Entity
@Table(name = "AIQICHA_TENDER_BIDDING")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "爱企查-招/投标信息 映射")
public class AiqichaTenderBiddingPo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = 7560586064089209460L;
    @Schema(description = "企业系统ID")
    @TableField(value = "PID")
    @Column(name = "PID", columnDefinition = "BIGINT(19) NOT NULL COMMENT '企业系统ID'")
    private Long pid;
    @Schema(description = "发布日期")
    @TableField(value = "PUBLISH_DATE")
    @Column(name = "PUBLISH_DATE", columnDefinition = "DATETIME COMMENT '发布日期'")
    private Date publishDate;
    @Schema(description = "标题")
    @TableField(value = "TITLE")
    @Column(name = "TITLE", columnDefinition = "VARCHAR(128) COMMENT '标题'")
    private String title;
    @Schema(description = "地域")
    @TableField(value = "DISTRICT")
    @Column(name = "DISTRICT", columnDefinition = "VARCHAR(128) COMMENT '地域'")
    private String district;
    @Schema(description = "招标公司")
    @TableField(value = "TENDER")
    @Column(name = "TENDER", columnDefinition = "TEXT(65,535) COMMENT '招标公司'")
    private String tender;
    @Schema(description = "中标公司")
    @TableField(value = "WINNER")
    @Column(name = "WINNER", columnDefinition = "TEXT(65,535) COMMENT '中标公司'")
    private String winner;

    @Schema(description = "基本信息")
    @TableField(exist = false)
    @ManyToOne(targetEntity = AiqichaHeaderPo.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "PID", referencedColumnName = "PID", insertable = false, updatable = false)
    private AiqichaHeaderPo aiqichaHeaderPo;
}
